package com.report.dto.response;

import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.SearchBean;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author summer
 * @version 1.0
 * @date 2024/8/16 08:37
 */
@Data
@SearchBean(tables = " research_member m left join (SELECT count(*) as readNum,member_id from research_browse where DATE(create_time) >=DATE_SUB(CURDATE(),INTERVAL 7 DAY) group by member_id) b ON m.id=b.member_id",autoMapTo = "m", orderBy = "readNum DESC ")
public class ReadRankingRes implements Serializable {

    @DbField("m.id")
    private Integer id;

    @DbField("m.nickName")
    private String name;

    @DbField("m.avatarUrl")
    private String image;

    @DbField("CASE WHEN b.readNum IS NULL THEN 0 ELSE b.readNum END")
    private Integer readNum;

    @DbField("m.zanNum")
    private Integer zanNum;


}
